//
//  ViewController.swift
//  表情键盘
//
//  Created by mac on 15/5/23.
//  Copyright (c) 2015年 mac. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var textView: EmosionTextView!
    //--------------step 2---添加表情键盘----------------------------------------------------------
    lazy var keyboardVC: EmotionKeyboardViewController = {
        
        weak var weakself = self
        return EmotionKeyboardViewController(completeEmosion: { (emotion) -> () in
//            weakself?.textView.text = emotion.chs
            weakself?.textView.emosionInsert(emotion)
//            println(emotion.chs) ///Step: <21>
        })
        
    }()
    

    
    
    
    //--------------step 3---键盘替换----------------------------------------------------------
    private func setUI(){
        
        addChildViewController(keyboardVC)
        textView.inputView = keyboardVC.view
        
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        Emotions.emostionsList() ///Step: 9 打印测试
        setUI() //Step: 3
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func showmessage() {
        textView.fulltext()
    }

}

